<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Home extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('file');
        $this->load->helper('fuc');
        $this->load->library('topclass');
        $this->load->database();
        $this->config->load('topapiconfig');
    }

    public function index() {

        $this->load->view('welcome_message');
    }

    public function commnetwall() {
        $configarray = $this->config->item('new_app');
        $sessinkey = $configarray["sessionkey"];
        $res = $this->topclass->api_TraderatesGetRequest("TraderatesGetRequest", $sessinkey);
        objectToArray(&$res);
        if (isset($res["trade_rates"]["trade_rate"])) {
            $comment_array = array();
            foreach ($res["trade_rates"]["trade_rate"] as $key => $val) {

                $comment_array[$key]["created"] = $val["created"];
                $comment_array[$key]["buy_nick"] = $val["nick"];
                $comment_array[$key]["item_title"] = $val["item_title"];
                $comment_array[$key]["item_price"] = $val["item_price"];
                $comment_array[$key]["result"] = $val["result"];
                $comment_array[$key]["content"] = $val["content"];
                $comment_array[$key]["buy_avter"] = "暂时未获取";
                $comment_array[$key]["buy_level"] = "暂时未获取";
            }
        }
        print_r($comment_array);
    }

    public function tradetimeline() {
        $configarray = $this->config->item('new_app');
        $sessinkey = $configarray["sessionkey"];
        $res = $this->topclass->api_TradesSoldGetRequest("TradesSoldGetRequest", $sessinkey);
        objectToArray(&$res);
         if (isset($res["trades"]["trade"])) {
              print_r($trades_array=$res["trades"]["trade"]);
         }
     
        
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */